]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
texture-cache: Don't share requests for uncachable textures
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 4 Oct 2011 23:18:16 +0000 (01:18 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 5 Oct 2011 19:30:27 +0000 (21:30 +0200)
Make create_texture_and_ensure_request() aware of the caching
policy to avoid returning the same texture for different
images.

https://bugzilla.gnome.org/show_bug.cgi?id=660585

src/st/st-texture-cache.c

index 1e83a0dea2beb8041412a3ec11edd89e077bccc8..040165001592fd730af5a0a2053c5758f1223eed 100644 (file)
@@ -1115,6 +1115,7 @@ st_texture_cache_load (StTextureCache       *cache,
  * @cache:
  * @key: A cache key
  * @size: Size in pixels
+ * @policy: Cache policy
  * @request: (out): If no request is outstanding, one will be created and returned here
  * @texture: (out): A new texture, also added to the request
  *
@@ -1128,6 +1129,7 @@ static gboolean
 create_texture_and_ensure_request (StTextureCache        *cache,
                                    const char            *key,
                                    guint                  size,
+                                   StTextureCachePolicy   policy,
                                    AsyncTextureLoadData **request,
                                    ClutterActor         **texture)
 {
@@ -1154,7 +1156,8 @@ create_texture_and_ensure_request (StTextureCache        *cache,
     {
       /* Not cached and no pending request, create it */
       *request = g_new0 (AsyncTextureLoadData, 1);
-      g_hash_table_insert (cache->priv->outstanding_requests, g_strdup (key), *request);
+      if (policy != ST_TEXTURE_CACHE_POLICY_NONE)
+        g_hash_table_insert (cache->priv->outstanding_requests, g_strdup (key), *request);
     }
   else
    *request = pending;
@@ -1203,7 +1206,7 @@ load_gicon_with_colors (StTextureCache    *cache,
     }
   g_free (gicon_string);
 
-  if (create_texture_and_ensure_request (cache, key, size, &request, &texture))
+  if (create_texture_and_ensure_request (cache, key, size, policy, &request, &texture))
     {
       g_free (key);
       return texture;